#include "asm.h"
#include "regdef.h"
#include "inst_test.h"

LEAF(n33_mulh_w_test)
    
    addi.w s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_MULH_W(0x45b90738, 0xd70d64f0, 0xf4d903bb)
    TEST_MULH_W(0x99a451b0, 0xbe3d9998, 0x1a4b01ae)
    TEST_MULH_W(0x85931c58, 0xfb710fb5, 0x022e0ede)
    TEST_MULH_W(0x650e4043, 0x64c17218, 0x27c5ede2)
    TEST_MULH_W(0xa00c6c50, 0x8e9df080, 0x2a7f453e)
    TEST_MULH_W(0x99c874b6, 0xd7ce83e0, 0x100c6ff4)
    TEST_MULH_W(0x1c62f360, 0x34580400, 0x05cddbe4)
    TEST_MULH_W(0x99b80b00, 0x6c463000, 0xd4bd99c9)
    TEST_MULH_W(0xdc823390, 0x5208f838, 0xf4a0762c)
    TEST_MULH_W(0xe53080d8, 0x848a9c5a, 0x0cedfd5c)
    TEST_MULH_W(0x7f2163d8, 0xab5bba80, 0xd5f77755)
    TEST_MULH_W(0xea7b88c0, 0x23eed510, 0xfcfad0a2)
    TEST_MULH_W(0x7389b4fd, 0xea063940, 0xf614f983)
    TEST_MULH_W(0xbcdf9b20, 0xc1451978, 0x1072da6a)
    TEST_MULH_W(0xdcacfd50, 0x809d0a80, 0x1193d5fc)
    TEST_MULH_W(0x55ed3100, 0xbe5ba9f2, 0xe9f79db9)
    TEST_MULH_W(0xcedb5fd8, 0xe1793b60, 0x05dc29af)
    TEST_MULH_W(0x9d32f1b0, 0xbb2016b8, 0x1a94e275)
    TEST_MULH_W(0x7091ae43, 0xdb390460, 0xefd4042c)
    TEST_MULH_W(0x549bf440, 0xd1dc9f40, 0xf0c048d0)
    TEST_MULH_W(0x63b241cc, 0x48aefe14, 0x1c4e489c)
    TEST_MULH_W(0x4c925040, 0x0855d2c8, 0x027e3e22)
    TEST_MULH_W(0xdb2dfd2c, 0x6c0e9f09, 0xf0754c72)
    TEST_MULH_W(0xdfdc9250, 0xbf1f15c3, 0x082517d4)
    TEST_MULH_W(0x1b339b35, 0x98c14bc0, 0xf50792e7)
    TEST_MULH_W(0xc8618b98, 0x69452a40, 0xe920fb5e)
    TEST_MULH_W(0x2aea0580, 0x7f50d684, 0x1557a5d1)
    TEST_MULH_W(0x5c69f5ec, 0x9ee23bd2, 0xdcf11afe)
    TEST_MULH_W(0xb7b66b40, 0x8b50c179, 0x20f2d35b)
    TEST_MULH_W(0x514e33b6, 0x7dc39988, 0x27f14e94)
    TEST_MULH_W(0x27c24e12, 0xbc0e6874, 0xf572a01c)
    TEST_MULH_W(0xe7e6eddc, 0x13a7cad0, 0xfe265835)
    TEST_MULH_W(0xa85111c0, 0xa29d50f0, 0x1ffc597a)
    TEST_MULH_W(0x73d52eb8, 0x142ba310, 0x0920663d)
    TEST_MULH_W(0x41156884, 0x794c5fb2, 0x1ed68915)
    TEST_MULH_W(0xa8774820, 0xb2cf0480, 0x1a64deef)
    TEST_MULH_W(0xb69bcb80, 0x88d55520, 0x2229cfd4)
    TEST_MULH_W(0xe84175d8, 0x94048f1c, 0x0a03f608)
    TEST_MULH_W(0x6fdedbd8, 0x67dd7f60, 0x2d637581)
    TEST_MULH_W(0xa2319526, 0xd5f88700, 0x0f669a83)
    TEST_MULH_W(0x61f8b9bc, 0x146e6d38, 0x07d1b12e)
    TEST_MULH_W(0xb9002828, 0x0310a1b9, 0xff2663a0)
    TEST_MULH_W(0xb4418f47, 0x943f129c, 0x1fe1ae2e)
    TEST_MULH_W(0xd7011f8c, 0x70d8ea80, 0xededc132)
    TEST_MULH_W(0x058b9998, 0x55395538, 0x01d897ed)
    TEST_MULH_W(0xc13b7fc0, 0xda192fbb, 0x094afe25)
    TEST_MULH_W(0x776d24b0, 0x66f0a9a4, 0x3005c214)
    TEST_MULH_W(0x6c6ae338, 0x5c4abc80, 0x27161062)
    TEST_MULH_W(0x9dc090e0, 0xb6324980, 0x1c530986)
    TEST_MULH_W(0x86d609de, 0xcd4bcb2e, 0x17ff7c93)
    TEST_MULH_W(0x1400c7dc, 0x466a6d5e, 0x05808784)
    TEST_MULH_W(0xa2d88860, 0x26423686, 0xf2140c3a)
    TEST_MULH_W(0x6770770a, 0x812cbe10, 0xccc14912)
    TEST_MULH_W(0x95627048, 0xc1bae8ca, 0x19eeeef0)
    TEST_MULH_W(0x1dbadda0, 0x5d2b0f50, 0x0ad1e2ad)
    TEST_MULH_W(0xc7cf4f96, 0x7dd33820, 0xe461dd69)
    TEST_MULH_W(0xa1d8f960, 0xb83e3183, 0x1a641a33)
    TEST_MULH_W(0xcc2c955e, 0x63c2877e, 0xebcddc1e)
    TEST_MULH_W(0xd2d44530, 0x602b39e6, 0xef07f962)
    TEST_MULH_W(0x886c3ad7, 0xe011a4c0, 0x0eea3ae0)
    TEST_MULH_W(0x0c45d0c8, 0x830e02fb, 0xfa029504)
    TEST_MULH_W(0x49979c44, 0x298742f0, 0x0bf02a38)
    TEST_MULH_W(0x2037c800, 0xfb355f34, 0xff65a09f)
    TEST_MULH_W(0x21e68aeb, 0xc1cc4ec0, 0xf7c351f4)
    TEST_MULH_W(0xe2c488b8, 0x8ed6a9d8, 0x0cebf803)
    TEST_MULH_W(0x0622c000, 0x849e669e, 0xfd0af6e8)
    TEST_MULH_W(0xfe11325e, 0x5a980480, 0xff50e5e2)
    TEST_MULH_W(0xb582a660, 0x27161c30, 0xf4a0785f)
    TEST_MULH_W(0xde436ee0, 0x0b8fd2ea, 0xfe79f1a3)
    TEST_MULH_W(0x3ca5ebcc, 0x7fca89b0, 0x1e464b84)
    TEST_MULH_W(0xed8ac2a2, 0x8e11d628, 0x0836ec19)
    TEST_MULH_W(0xee62ac9c, 0x446aed90, 0xfb4ada5c)
    TEST_MULH_W(0xa5a41fa0, 0x901ecf7a, 0x277d522a)
    TEST_MULH_W(0x1665a95c, 0x01fa0f1c, 0x002c4643)
    TEST_MULH_W(0xf760c288, 0x024d9a70, 0xffec246c)
    TEST_MULH_W(0xb91b1700, 0xff6a7770, 0x0029690d)
    TEST_MULH_W(0x38a15d4c, 0x4d378f48, 0x1114d36c)
    TEST_MULH_W(0xe1d0a988, 0x29062820, 0xfb29b14f)
    TEST_MULH_W(0xb657c3ec, 0x42373c21, 0xecf2bc11)
    TEST_MULH_W(0x8cd72e00, 0x0657e392, 0xfd2581d5)
    TEST_MULH_W(0xcffca4a4, 0xf52aba30, 0x02082174)
    TEST_MULH_W(0xd823b826, 0xed601012, 0x02e66439)
    TEST_MULH_W(0x306f7f24, 0x6384a554, 0x12d436f0)
    TEST_MULH_W(0x0c59e770, 0x3e387808, 0x03007f82)
    TEST_MULH_W(0xc1dd451c, 0xe125f520, 0x077cfe1d)
    TEST_MULH_W(0xef4e68d4, 0x9ff2ad9b, 0x06437714)
    TEST_MULH_W(0x7ef6ec24, 0xb177da10, 0xd90d3e0e)
    TEST_MULH_W(0x6fb25f72, 0x791ebb10, 0x34d8b7a2)
    TEST_MULH_W(0x58101600, 0xd3840640, 0xf0b29693)
    TEST_MULH_W(0x07affc60, 0x5ea8d5b0, 0x02d7b093)
    TEST_MULH_W(0xf952c740, 0x73978b1c, 0xfcfc3bb4)
    TEST_MULH_W(0x8f689828, 0x91565574, 0x30abad94)
    TEST_MULH_W(0x914d8000, 0xba3b44b8, 0x1e2b2e25)
    TEST_MULH_W(0x4d2e3cf5, 0x70e9d5e8, 0x220aba3e)
    TEST_MULH_W(0xb037ad58, 0x11952040, 0xfa8538dd)
    TEST_MULH_W(0xa4246038, 0x111ad568, 0xf9dcc982)
    TEST_MULH_W(0xef964a3a, 0xd18d5d08, 0x02fa582f)
    TEST_MULH_W(0xa4a7728e, 0x97843fdc, 0x25482191)
    TEST_MULH_W(0xdf30b100, 0x250933f8, 0xfb40dba2)
    TEST_MULH_W(0x1d5818a4, 0xe5093304, 0xfce8c358)
    TEST_MULH_W(0x15122298, 0xcbbb9870, 0xfbb2afa1)
    TEST_MULH_W(0x88ca117e, 0x0e125f90, 0xf9727eaa)
    TEST_MULH_W(0xdf4ef397, 0xda63b6b6, 0x04cd8c0a)
    TEST_MULH_W(0x6683ae60, 0x63fc1988, 0x2809e048)
    TEST_MULH_W(0xe6a56cae, 0xd0003efb, 0x04c0f562)
    TEST_MULH_W(0x7d58aade, 0x5b2167ac, 0x2c9edfed)
    TEST_MULH_W(0x61118bd0, 0x9e016e14, 0xdad7d349)
    TEST_MULH_W(0x7fdd22be, 0xfdcc9fee, 0xfee69cb0)
    TEST_MULH_W(0x70e273a0, 0xd87fc19c, 0xee94f3a5)
    TEST_MULH_W(0x3940dad6, 0xa37c292b, 0xeb4f351f)
    TEST_MULH_W(0xba7ab435, 0x2322d7d0, 0xf6755053)
    TEST_MULH_W(0x0b238760, 0x2bff2a02, 0x01ea11f4)
    TEST_MULH_W(0xaa6a9390, 0x8d3ab108, 0x265e80ac)
    TEST_MULH_W(0xe3667224, 0xbf514d80, 0x0739e7c6)
    TEST_MULH_W(0x53b1b42e, 0x7c608578, 0x28a9a18c)
    TEST_MULH_W(0x8241ddf4, 0x4a8d0e90, 0xdb61c148)
    TEST_MULH_W(0x7cdcd5cf, 0xe584065f, 0xf3151a6c)
    TEST_MULH_W(0x50445224, 0xb34e8c5c, 0xe7f4141e)
    TEST_MULH_W(0x436d75a7, 0x2cb9b728, 0x0bc7ba90)
    TEST_MULH_W(0xdb906f30, 0x0eafa7d0, 0xfde8e5ee)
    TEST_MULH_W(0x5aa5b57e, 0xeb138c80, 0xf8975429)
    TEST_MULH_W(0xbc61fc9c, 0x2c0b0f78, 0xf45deb8a)
    TEST_MULH_W(0x8b3566b7, 0x2b021ecc, 0xec61009e)
    TEST_MULH_W(0x666e54e8, 0xed91452c, 0xf89fefde)
    TEST_MULH_W(0xc6e59380, 0xfa935180, 0x0135c230)
    TEST_MULH_W(0xd921e0b0, 0x1f7d65c0, 0xfb38104d)
    TEST_MULH_W(0x7b8db2e2, 0x84d37b50, 0xc48d6ea8)
    TEST_MULH_W(0xf89e1b58, 0x26be32a0, 0xfee1fbf1)
    TEST_MULH_W(0x524aa0a6, 0x0b334594, 0x0399b022)
    TEST_MULH_W(0xa3be10e8, 0x18dbc860, 0xf70a9cf8)
    TEST_MULH_W(0x073cf5be, 0x4fbf4882, 0x0241385d)
    TEST_MULH_W(0x91db7100, 0x1f78ebb0, 0xf2758c24)
    TEST_MULH_W(0xc49e36d8, 0x2044fa90, 0xf883c6c2)
    TEST_MULH_W(0xaf4ab2b8, 0xf0086f40, 0x0508ac17)
    TEST_MULH_W(0xc72f0de2, 0x407a26e0, 0xf1b0a744)
    TEST_MULH_W(0x95d26876, 0x9aaece1c, 0x2a05a9e7)
    TEST_MULH_W(0x72e2ec10, 0xb9098e00, 0xe0275a3b)
    TEST_MULH_W(0xdeb27a9c, 0x506c0849, 0xf589b888)
    TEST_MULH_W(0x530194f0, 0x00000000, 0x00000000)
    TEST_MULH_W(0x5a1a4f60, 0x00000000, 0x00000000)
    TEST_MULH_W(0x5cc4e136, 0x00000000, 0x00000000)
    TEST_MULH_W(0xab7a14c0, 0x00000000, 0x00000000)
    TEST_MULH_W(0x44d126d0, 0x00000000, 0x00000000)
    TEST_MULH_W(0x0f114ff0, 0x00000000, 0x00000000)
    TEST_MULH_W(0x60bfe48e, 0x00000000, 0x00000000)
    TEST_MULH_W(0x102ceba0, 0x00000000, 0x00000000)
    TEST_MULH_W(0x7b21e54d, 0x00000000, 0x00000000)
    TEST_MULH_W(0x5d72f954, 0x00000000, 0x00000000)
    TEST_MULH_W(0x2699b2d4, 0x00000000, 0x00000000)
    TEST_MULH_W(0x66b6dc30, 0x00000000, 0x00000000)
    TEST_MULH_W(0x00000000, 0x4ae569a0, 0x00000000)
    TEST_MULH_W(0x00000000, 0x2582c9c0, 0x00000000)
    TEST_MULH_W(0x00000000, 0xa2f01d2e, 0x00000000)
    TEST_MULH_W(0x00000000, 0x2c5300d7, 0x00000000)
    TEST_MULH_W(0x00000000, 0x7a95fab0, 0x00000000)
    TEST_MULH_W(0x00000000, 0xf415d1b4, 0x00000000)
    TEST_MULH_W(0x00000000, 0x0caf7d5c, 0x00000000)
    TEST_MULH_W(0x00000000, 0xae15e524, 0x00000000)
    TEST_MULH_W(0x00000000, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addi.w s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    slli.w t1, s0, 24
    NOP4
    or t0, t1, s3 
    NOP4
    st.w t0, s1, 0
    jirl zero, ra, 0
END(n33_mulh_w_test)
